# styles.py

def get_dark_mode_stylesheet(font_size):
    return f"""
    /* 全局样式 */
    QWidget {{
        font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
        font-size: {font_size}px;
        color: #333333;
    }}

    /* 主窗口背景 */
    QMainWindow {{
        background-color: #f5f7fa;
    }}

    /* 按钮样式 */
    QPushButton {{
        background-color: #4a6fa5;
        color: white;
        border: none;
        border-radius: 4px;
        padding: 6px 12px;
        min-width: 80px;
    }}

    QPushButton:hover {{
        background-color: #3a5a8f;
    }}

    QPushButton:pressed {{
        background-color: #2a4a7f;
    }}

    QPushButton:disabled {{
        background-color: #cccccc;
        color: #666666;
    }}

    /* 输入框 */
    QLineEdit, QTextEdit, QComboBox, QSpinBox {{
        border: 1px solid #ced4da;
        border-radius: 4px;
        padding: 6px;
        background-color: white;
    }}

    QLineEdit:focus, QTextEdit:focus, QComboBox:focus, QSpinBox:focus {{
        border: 1px solid #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }}

    /* 表格样式 */
    QTableWidget {{
        background-color: white;
        border: 1px solid #dee2e6;
        gridline-color: #dee2e6;
        selection-background-color: #d1e7ff;
        selection-color: black;
    }}

    QTableWidget QHeaderView::section {{
        background-color: #4a6fa5;
        color: white;
        padding: 6px;
        border: none;
    }}

    /* 分组框 */
    QGroupBox {{
        border: 1px solid #dee2e6;
        border-radius: 4px;
        margin-top: 10px;
        padding-top: 15px;
        background-color: white;
    }}

    QGroupBox::title {{
        subcontrol-origin: margin;
        left: 10px;
        padding: 0 3px;
    }}

    /* 标签 */
    QLabel {{
        color: #495057;
    }}

    /* 滚动区域 */
    QScrollArea {{
        border: 1px solid #dee2e6;
        background-color: white;
    }}

    /* 分页控件 */
    QLabel#page_label {{
        font-weight: bold;
    }}

    /* 复选框和单选按钮 */
    QCheckBox, QRadioButton {{
        spacing: 5px;
    }}

    /* 进度条 */
    QProgressBar {{
        border: 1px solid #ced4da;
        border-radius: 3px;
        text-align: center;
    }}

    QProgressBar::chunk {{
        background-color: #4a6fa5;
    }}

    /* 菜单栏 */
    QMenuBar {{
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
    }}

    QMenuBar::item {{
        padding: 5px 10px;
        background: transparent;
    }}

    QMenuBar::item:selected {{
        background: #e2e6ea;
    }}

    QMenu {{
        background-color: white;
        border: 1px solid #dee2e6;
    }}

    QMenu::item:selected {{
        background-color: #d1e7ff;
    }}

    /* 选项卡 */
    QTabWidget::pane {{
        border: 1px solid #dee2e6;
        top: -1px;
    }}

    QTabBar::tab {{
        background: #e9ecef;
        border: 1px solid #dee2e6;
        border-bottom: none;
        padding: 6px 12px;
        margin-right: 2px;
    }}

    QTabBar::tab:selected {{
        background: white;
        border-bottom: 1px solid white;
    }}

    /* 刷题模式特殊样式 */
    QLabel#question_content {{
        font-size: 16px;
        line-height: 1.6;
    }}

    QLabel#question_answer {{
        font-size: 14px;
        line-height: 1.6;
        color: #28a745;
    }}

    QTextEdit#notes_edit {{
        font-size: 13px;
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }}

    /* 锁定按钮样式 */
    QPushButton#lockButton {{
        padding: 6px 12px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        margin-bottom: 10px;
    }}

    QPushButton#lockButton:checked {{
        background-color: #d4edda;
        border-color: #c3e6cb;
        color: #155724;
    }}

    QPushButton#lockButton:checked:hover {{
        background-color: #c3e6cb;
    }}

    ShareDialog {{
        background-color: #f8f9fa;
    }}

    QLabel#qrcodeLabel {{
        border: 1px solid #dee2e6;
        padding: 10px;
        background-color: white;
        margin: 10px;
    }}

    QPushButton {{
        min-width: 100px;
        padding: 8px;
        border-radius: 4px;
        background-color: #4a6fa5;
        color: white;
    }}

    QPushButton:hover {{
        background-color: #3a5a8f;
    }}

    QPushButton:pressed {{
        background-color: #2a4a7f;
    }}

    /* About Dialog 样式 */
    QLabel {{
        line-height: 1.8;
        color: #444;
    }}

    QLabel h2 {{
        color: #2c3e50;
        margin-bottom: 15px;
    }}

    QLabel ul {{
        margin: 10px 0;
        padding-left: 20px;
    }}
            QSpinBox::up-button {{
        subcontrol-origin: border;
        subcontrol-position: top right;
    }}
    QSpinBox::down-button {{
        subcontrol-origin: border;
        subcontrol-position: bottom right;
    }}
    """


def get_light_mode_stylesheet(font_size):
    return f"""
    /* 全局样式 */
    QWidget {{
        font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
        font-size: {font_size}px;
        color: #e0e0e0;
        background-color: #333;
    }}

    /* 主窗口背景 */
    QMainWindow {{
        background-color: #333;
    }}

    /* 按钮样式 */
    QPushButton {{
        background-color: #4a6fa5;
        color: white;
        border: none;
        border-radius: 4px;
        padding: 6px 12px;
        min-width: 80px;
    }}

    QPushButton:hover {{
        background-color: #3a5a8f;
    }}

    QPushButton:pressed {{
        background-color: #2a4a7f;
    }}

    QPushButton:disabled {{
        background-color: #555;
        color: #888;
    }}

    /* 输入框 */
    QLineEdit, QTextEdit, QComboBox, QSpinBox {{
        border: 1px solid #555;
        border-radius: 4px;
        padding: 6px;
        background-color: #444;
        color: #e0e0e0;
    }}

    QLineEdit:focus, QTextEdit:focus, QComboBox:focus, QSpinBox:focus {{
        border: 1px solid #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }}

    /* 表格样式 */
    QTableWidget {{
        background-color: #444;
        border: 1px solid #555;
        gridline-color: #555;
        selection-background-color: #5a5a5a;
        selection-color: white;
    }}

    QTableWidget QHeaderView::section {{
        background-color: #4a6fa5;
        color: white;
        padding: 6px;
        border: none;
    }}

    /* 分组框 */
    QGroupBox {{
        border: 1px solid #555;
        border-radius: 4px;
        margin-top: 10px;
        padding-top: 15px;
        background-color: #444;
    }}

    QGroupBox::title {{
        subcontrol-origin: margin;
        left: 10px;
        padding: 0 3px;
        color: #e0e0e0;
    }}

    /* 标签 */
    QLabel {{
        color: #e0e0e0;
    }}

    /* 滚动区域 */
    QScrollArea {{
        border: 1px solid #555;
        background-color: #444;
    }}

    /* 分页控件 */
    QLabel#page_label {{
        font-weight: bold;
        color: #e0e0e0;
    }}

    /* 复选框和单选按钮 */
    QCheckBox, QRadioButton {{
        spacing: 5px;
        color: #e0e0e0;
    }}

    /* 进度条 */
    QProgressBar {{
        border: 1px solid #555;
        border-radius: 3px;
        text-align: center;
        color: #e0e0e0;
    }}

    QProgressBar::chunk {{
        background-color: #4a6fa5;
    }}

    /* 菜单栏 */
    QMenuBar {{
        background-color: #444;
        border-bottom: 1px solid #555;
    }}

    QMenuBar::item {{
        padding: 5px 10px;
        background: transparent;
        color: #e0e0e0;
    }}

    QMenuBar::item:selected {{
        background: #5a5a5a;
    }}

    QMenu {{
        background-color: #444;
        border: 1px solid #555;
        color: #e0e0e0;
    }}

    QMenu::item:selected {{
        background-color: #5a5a5a;
    }}

    /* 选项卡 */
    QTabWidget::pane {{
        border: 1px solid #555;
        top: -1px;
    }}

    QTabBar::tab {{
        background: #444;
        border: 1px solid #555;
        border-bottom: none;
        padding: 6px 12px;
        margin-right: 2px;
        color: #e0e0e0;
    }}

    QTabBar::tab:selected {{
        background: #5a5a5a;
        border-bottom: 1px solid #5a5a5a;
        color: white;
    }}

    /* 刷题模式特殊样式 */
    QLabel#question_content {{
        font-size: 16px;
        line-height: 1.6;
        color: #e0e0e0;
    }}

    QLabel#question_answer {{
        font-size: 14px;
        line-height: 1.6;
        color: #28a745;
    }}

    QTextEdit#notes_edit {{
        font-size: 13px;
        border: 1px solid #555;
        border-radius: 4px;
        background-color: #444;
        color: #e0e0e0;
    }}

    /* 锁定按钮样式 */
    QPushButton#lockButton {{
        padding: 6px 12px;
        border: 1px solid #555;
        border-radius: 4px;
        margin-bottom: 10px;
        background-color: #4a6fa5;
        color: white;
    }}

    QPushButton#lockButton:checked {{
        background-color: #d4edda;
        border-color: #c3e6cb;
        color: #155724;
    }}

    QPushButton#lockButton:checked:hover {{
        background-color: #c3e6cb;
    }}

    ShareDialog {{
        background-color: #444;
        color: #e0e0e0;
    }}

    QLabel#qrcodeLabel {{
        border: 1px solid #555;
        padding: 10px;
        background-color: #444;
        margin: 10px;
        color: #e0e0e0;
    }}

    QPushButton {{
        min-width: 100px;
        padding: 8px;
        border-radius: 4px;
        background-color: #4a6fa5;
        color: white;
    }}

    QPushButton:hover {{
        background-color: #3a5a8f;
    }}

    QPushButton:pressed {{
        background-color: #2a4a7f;
    }}

    /* About Dialog 样式 */
    QLabel {{
        line-height: 1.8;
        color: #e0e0e0;
    }}

    QLabel h2 {{
        color: #2c3e50;
        margin-bottom: 15px;
    }}

    QLabel ul {{
        margin: 10px 0;
        padding-left: 20px;
        color: #e0e0e0;
    }}
        QSpinBox::up-button {{
        subcontrol-origin: border;
        subcontrol-position: top right;
    }}
    QSpinBox::down-button {{
        subcontrol-origin: border;
        subcontrol-position: bottom right;
    }}
     
    """
def get_ini_stylesheet():
    return """
        /* 全局样式 */
        QWidget {
            font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
                font-size: {self.current_font_size}px;
            color: #333333;
        }

        /* 主窗口背景 */
        QMainWindow {
            background-color: #f5f7fa;
        }

        /* 按钮样式 */
        QPushButton {
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 6px 12px;
            min-width: 80px;
        }

        QPushButton:hover {
            background-color: #3a5a8f;
        }

        QPushButton:pressed {
            background-color: #2a4a7f;
        }

        QPushButton:disabled {
            background-color: #cccccc;
            color: #666666;
        }


        /* 输入框 */
        QLineEdit, QTextEdit, QComboBox, QSpinBox {
            border: 1px solid #ced4da;
            border-radius: 4px;
            padding: 6px;
            background-color: white;
        }

        QLineEdit:focus, QTextEdit:focus, QComboBox:focus, QSpinBox:focus {
            border: 1px solid #80bdff;
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        }

        /* 表格样式 */
        QTableWidget {
            background-color: white;
            border: 1px solid #dee2e6;
            gridline-color: #dee2e6;
            selection-background-color: #d1e7ff;
            selection-color: black;
        }

        QTableWidget QHeaderView::section {
            background-color: #4a6fa5;
            color: white;
            padding: 6px;
            border: none;
        }

        /* 分组框 */
        QGroupBox {
            border: 1px solid #dee2e6;
            border-radius: 4px;
            margin-top: 10px;
            padding-top: 15px;
            background-color: white;
        }

        QGroupBox::title {
            subcontrol-origin: margin;
            left: 10px;
            padding: 0 3px;
        }

        /* 标签 */
        QLabel {
            color: #495057;
        }

        /* 滚动区域 */
        QScrollArea {
            border: 1px solid #dee2e6;
            background-color: white;
        }

        /* 分页控件 */
        QLabel#page_label {
            font-weight: bold;
        }

        /* 复选框和单选按钮 */
        QCheckBox, QRadioButton {
            spacing: 5px;
        }

        /* 进度条 */
        QProgressBar {
            border: 1px solid #ced4da;
            border-radius: 3px;
            text-align: center;
        }

        QProgressBar::chunk {
            background-color: #4a6fa5;
        }

        /* 菜单栏 */
        QMenuBar {
            background-color: #f8f9fa;
            border-bottom: 1px solid #dee2e6;
        }

        QMenuBar::item {
            padding: 5px 10px;
            background: transparent;
        }

        QMenuBar::item:selected {
            background: #e2e6ea;
        }

        QMenu {
            background-color: white;
            border: 1px solid #dee2e6;
        }

        QMenu::item:selected {
            background-color: #d1e7ff;
        }

        /* 选项卡 */
        QTabWidget::pane {
            border: 1px solid #dee2e6;
            top: -1px;
        }

        QTabBar::tab {
            background: #e9ecef;
            border: 1px solid #dee2e6;
            border-bottom: none;
            padding: 6px 12px;
            margin-right: 2px;
        }

        QTabBar::tab:selected {
            background: white;
            border-bottom: 1px solid white;
        }

        /* 刷题模式特殊样式 */
        QLabel#question_content {
            font-size: 16px;
            line-height: 1.6;
        }

        QLabel#question_answer {
            font-size: 14px;
            line-height: 1.6;
            color: #28a745;
        }

        QTextEdit#notes_edit {
            font-size: 13px;
            border: 1px solid #dee2e6;
            border-radius: 4px;
        }
            /* 锁定按钮样式 */
    QPushButton#lockButton {
        padding: 6px 12px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        margin-bottom: 10px;
    }
    
    QPushButton#lockButton:checked {
        background-color: #d4edda;
        border-color: #c3e6cb;
        color: #155724;
    }
    
    QPushButton#lockButton:checked:hover {
        background-color: #c3e6cb;
    }
        ShareDialog {
        background-color: #f8f9fa;
    }
    
    QLabel#qrcodeLabel {
        border: 1px solid #dee2e6;
        padding: 10px;
        background-color: white;
        margin: 10px;
    }
    
    QPushButton {
        min-width: 100px;
        padding: 8px;
        border-radius: 4px;
        background-color: #4a6fa5;
        color: white;
    }
    
    QPushButton:hover {
        background-color: #3a5a8f;
    }
    
    QPushButton:pressed {
        background-color: #2a4a7f;
    }
    /* About Dialog 样式 */
QLabel {
    line-height: 1.8;
    color: #444;
}

QLabel h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

QLabel ul {
    margin: 10px 0;
    padding-left: 20px;
}
    QSpinBox::up-button {
        subcontrol-origin: border;
        subcontrol-position: top right;
    }
    QSpinBox::down-button {
        subcontrol-origin: border;
        subcontrol-position: bottom right;
    }    
    """


def get_help():
    return """
        <h2>白光题集 V1.9.5</h2>
        <p>一款专业的题库管理学习工具，旨在帮助用户高效地管理和学习题库。</p>
        <hr>
        <h3>主要功能</h3>
        <ul>
            <li><strong>题目数据管理：</strong>支持题目数据的增删改查操作，方便用户维护题库。</li>
            <li><strong>智能刷题学习模式：</strong>提供多种刷题模式，帮助用户高效学习。</li>
            <li><strong>题目分类标签管理：</strong>支持为题目添加分类和标签，方便用户组织和查找题目。</li>
            <li><strong>个性化界面设置：</strong>支持暗夜模式和字体大小调整，提升用户体验。</li>
        </ul>
        <hr>
        <h3>操作指南</h3>
        <ul>
            <li><strong>添加题目：</strong>点击“题目录入”按钮，填写题目信息后点击保存。</li>
            <li><strong>查看题目：</strong>点击“题目列表”按钮，查看已有的题目。</li>
            <li><strong>编辑题目：</strong>在题目列表中选择题目，点击编辑按钮进行修改。</li>
            <li><strong>删除题目：</strong>在题目列表中选择题目，点击删除按钮进行删除。</li>
            <li><strong>刷题模式：</strong>点击“刷题模式”按钮，选择相应的刷题设置开始刷题。</li>
            <li><strong>分类标签管理：</strong>点击“分类标签管理”按钮，添加或编辑分类和标签。</li>
            <li><strong>导出题目：</strong>点击“导出试题”按钮，设置导出条件和格式后导出题目。</li>
            <li><strong>个性化设置：</strong>点击“设置”按钮，调整字体大小和界面模式。</li>
        </ul>
        <hr>
        <h3>常见问题解答</h3>
        <ul>
            <li><strong>如何添加题目？</strong>点击“题目录入”按钮，填写题目信息后点击保存。</li>
            <li><strong>如何查看题目？</strong>点击“题目列表”按钮，查看已有的题目。</li>
            <li><strong>如何编辑题目？</strong>在题目列表中选择题目，点击编辑按钮进行修改。</li>
            <li><strong>如何删除题目？</strong>在题目列表中选择题目，点击删除按钮进行删除。</li>
            <li><strong>如何使用刷题模式？</strong>点击“刷题模式”按钮，选择相应的刷题设置开始刷题。</li>
            <li><strong>如何管理分类标签？</strong>点击“分类标签管理”按钮，添加或编辑分类和标签。</li>
            <li><strong>如何导出题目？</strong>点击“导出试题”按钮，设置导出条件和格式后导出题目。</li>
            <li><strong>如何调整界面设置？</strong>点击“设置”按钮，调整字体大小和界面模式。</li>
        </ul>
        <hr>
        <p><b>技术支持：</b>PyQt5 + SQLite3</p>
        <p><b>授权协议：</b>仅供个人学习使用</p>
        """
